package com.itheima.mapper;

import com.itheima.dto.EmpDto;
import com.itheima.dto.EmpLoginDto;
import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 员工管理
 */
@Mapper
public interface EmpMapper {
//    @Select("select * from emp limit #{start},#{pageSize}")
//    public List<Emp> getByPage(@Param("start") Integer strat,@Param("pageSize") Integer pageSize);
//    @Select("select count(*) from emp")
//    public Long getTotal();
    @Select("select * from emp")
    public List<Emp> getByPage();

    List<Emp> getByPage2(EmpDto empDto);

    int deleteById(@Param("ids") Integer[] ids);
    @Insert("insert into emp values (null,#{username},#{password},#{name},#{gender},#{image},#{job},#{entrydate},#{deptId},#{createTime},#{updateTime})")
    int insertEmp(Emp emp);
    @Select("select * from emp where id=#{id}")
    Emp getById(Integer id);
    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp login(EmpLoginDto dto);
    @Delete("delete from emp where dept_id = #{deptid}")
    int delByDeptId(Integer deptid);
//    void upDate(Emp emp);
}
